<%@include file="package.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%@include file="includ.jsp" %>
<table border="1px">
<tr>
<td>学号</td>
<td>姓名</td>
<td>性别</td>
<td>telephone</td>
<td>qq</td>
<td>wechat</td>
<td>gradeid</td>
<td>enterdate</td>
<td>fromcity</td>
<td>birthday</td>
<td>address</td>
<td>pass</td>
<td colspan="3">操作</td>
</tr>
<%
String x=null;
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
StudentSerive ss=new StudentSerive();
List<Student> list=ss.findAll();
int a=list.size();
int pages=a/15+(a%15==0?0:1);
String pagNo1=request.getParameter("pagNo");
if(pagNo1==null){
	pagNo1="1";
}
int pagNo=Integer.parseInt(pagNo1);
List<Student> list1=ss.paging2(pagNo, 15);
for(Student stu:list1){
	
%>
<tr>
<td><%=stu.getStuno() %></td>
<td><%=stu.getSname() %></td>
<td><%=stu.getSex() %></td>
<td><%=stu.getTelephone() %></td>
<td><%=stu.getQq() %></td>
<td><%=stu.getWechat() %></td>
<td><%=stu.getGradeid() %></td>
<td><%=stu.getEnterdate()==null?x:format.format(stu.getEnterdate()) %></td>
<td><%=stu.getFromcity() %></td>
<td><%=stu.getBirthday()==null?x:format.format(stu.getBirthday()) %></td>
<td><%=stu.getAddress() %></td>
<td><%=stu.getPass() %></td>
<td ><a href="delet.jsp?stuno=<%=stu.getStuno() %>&&sname=<%=stu.getSname() %>">删除</a></td>
<td ><a href="updateStudent.jsp?stuno=<%=stu.getStuno() %>">修改</a></td>
<td ><a href="StudentSubmit.jsp">增加</a></td>
</tr>
<%} %>
</table>
<p>
<span>共<%=a %>条</span>
<span>第<%=pagNo %>/<%=pages%>页</span>
<p id="shang"><a href="studentshow.jsp">首页</a>
<%if(pagNo>1){ %>
<a href="studentshow.jsp?pagNo=<%=pagNo-1%>">上一页</a>
<%} %>
<%if(pagNo<pages){ %>
<a href="studentshow.jsp?pagNo=<%=pagNo+1%>">下一页</a>
<%} %>

<a href="studentshow.jsp?pagNo=<%=pages%>">末页</a>
go<input id="tiaozhuan" type="number" name="tiaozhuan">页
</p>

<script src="jquery-3.4.1.js"></script>
<script type="text/javascript">
$(function () {
	$("#tiaozhuan").blur(function () {
	var pagNo= $(this).val();
	<%-- $(this).next().text("<%response.sendRedirect(\"studentshow.jsp?pagNo="+pagNo +"\"); %>") --%>
	 location.replace("studentshow.jsp?pagNo="+pagNo);
	})
});

</script>
</body>
</html>